package com.syh.jn.scm.domain.supplier.entity.base.downstream;

import cn.redscarf.commons.util.bean.ExtBeanUtils;
import cn.redscarf.commons.util.other.ExtAssert;
import cn.redscarf.commons.util.validator.ValidationUtils;
import com.syh.jn.scm.domain.support.SuperBusinessEntity;
import com.syh.jn.scm.dto.supplier.base.downstream.DownstreamAddressSto;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

import java.util.UUID;

/**
 * 下游客户地址
 */
@Data
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class DownstreamAddress extends SuperBusinessEntity<Long> {
  /**
   * 新建下游客户地址
   *
   * @param dto
   * @return
   */
  public static DownstreamAddress create(DownstreamAddressSto dto) {
    ExtAssert.notNull(dto, "对象为空");
    ValidationUtils.validate(dto);

    DownstreamAddress address = new DownstreamAddress();
    ExtBeanUtils.copyProperties(dto, address);
    address.setUuid(UUID.randomUUID().toString());
    address.createDateTimestamp = System.currentTimeMillis();

    return address;
  }


  /**
   * 地址省 市 区
   */
  private String area;
  /**
   * 地址
   */
  private String address;
  /**
   * 地区编号
   */
  private String areaCode;
  /**
   * 联系人
   */
  private String contacts;
  /**
   * 联系手机
   */
  private String mobile;
  /**
   * 创建日期
   */
  private Long createDateTimestamp;
}
